package tc.alert.tckejisoc.kafka.service;

import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tc.alert.tckejisoc.domain.EventBase;
import tc.alert.tckejisoc.service.GeoIPService;
@Component
@Slf4j
public class DataWork {
    @Autowired
    private GeoIPService geoIPService;
   public void ip(EventBase unifiedLog){
        //经纬度处理
        if (unifiedLog.getSrcIp() != null) {
            double[] latlon = geoIPService.getLatitudeLongitude(unifiedLog.getSrcIp());
            if(null!=latlon) {
                unifiedLog.setSrcgeolat(latlon[0] + "");
                unifiedLog.setSrcgeolon(latlon[1] + "");
            }
        }
        if ( unifiedLog.getDstIp() != null) {
            double[] latlon = geoIPService.getLatitudeLongitude(unifiedLog.getDstIp());
            if(null!=latlon) {
                unifiedLog.setDstgeolat(latlon[0] + "");
                unifiedLog.setDstgeolon(latlon[1] + "");
            }
        }
    }

    public void data(EventBase unifiedLog){

       //获得 ip信息  检索 资产信息

    }
}
